// import service from '@/util/request'
import service from '@/utils/requestU'
import apis from './api'
import request from '@/utils/request'
let api = {};
for (let k in apis) {
  if(apis[k].type=='post1'){
    api[k] = function (params) {
      return service({
        url: "/scrm-uer/" + window.atob(apis[k].url),
        method: 'post',
        data: params
      })
    }
  }
  else{
    api[k] = function (params) {
      return service({
        url: "/scrm-uer/" + window.atob(apis[k].url),
        method: apis[k].type,
        params: params
      })
    }
  }
}

api = {
  ...api,
  // 增加任务定义配置
  addTaskConfiguration: (params)=> {
    return service({
      url: "/scrm-uer/taskConfiguration/add",
      method: 'POST',
      data: params
    })
  },
  // 查询任务定义规则列表
  getTaskConfigurationList: (params)=> {
    return service({
      url: "/scrm-uer/taskConfiguration/list",
      method: 'GET',
      params: params
    })
  },
  // 修改任务定义配置
  editTaskConfiguration: (params)=> {
    return service({
      url: "/scrm-uer/taskConfiguration/edit",
      method: 'POST',
      data: params
    })
  },
  // 查询任务定义配置详情
  queryTaskConfigurationDetail: (params)=> {
    return service({
      url: "/scrm-uer/taskConfiguration/detail",
      method: 'GET',
      params: params
    })
  },
  // 删除任务定义配置
  deleteTaskConfiguration: (params)=> {
    return service({
      url: "/scrm-uer/taskConfiguration/delete",
      method: 'GET',
      params: params
    })
  },

  // 新增服务计划配置
  addPlaned: (params)=> {
    return service({
      url: "/scrm-uer/servicePlan/add",
      method: 'POST',
      data: params
    })
  },
  // 修改服务计划配置
  editPlaned: (params)=> {
    return service({
      url: "/scrm-uer/servicePlan/edit",
      method: 'POST',
      data: params
    })
  },
  // 新增服务计划配置
  getPlanedList: (params)=> {
    return service({
      url: "/scrm-uer/servicePlan/list",
      method: 'GET',
      params: params
    })
  },
  // 查询服务计划详情
  queryPlanedDetail: (params)=> {
    return service({
      url: "/scrm-uer/servicePlan/detail",
      method: 'GET',
      params: params
    })
  },
  // 删除服务计划
  deletePlaned: (params)=> {
    return service({
      url: "/scrm-uer/servicePlan/delete",
      method: 'GET',
      params: params
    })
  },

  // 获取服务计划配置
  reachModeDetail: (params)=> {
    return service({
      url: "/scrm-uer/reachMode/detail",
      method: 'GET',
      params: params
    })
  },

  // 获取服务计划配置
  reachModeAdd: (data)=> {
    return service({
      url: "/scrm-uer/reachMode/addOrUpdate",
      method: 'POST',
      data
    })
  },

  // 获取详情
  getPlanDetail: (id) =>{
    return request({
      url: '/scrm-uer/api/work/getPlanDetail/' + id,
      method: 'get',
    })
  }
}
export default api
